﻿using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using ATM_System_Mock1_G2;
using Entities;
using DataAccess;
using BusinessLogic;
using System.Data;

namespace TestMock1_G2
{
    [TestClass]
    public class Unittest_Quoc
    {
        [TestMethod]
        public void Write_Log1()
        {
            LogEntites logE = new LogEntites();
            LogDA logDA = new LogDA();
            logE.LogTypeID = int.Parse("2");
            logE.LogDate = DateTime.Now;
            logE.ATMID = int.Parse("3");
            logE.CardNo = "1234567891234568";
            logE.Amount = int.Parse("300000");
            logE.Details = "Withdraw";
            bool exp = logDA.WriteLog(logE);
            Assert.IsTrue(exp);

        }

        [TestMethod]
        public void UpdateQuantityATM1()
        {
            StockEntites stockE = new StockEntites();
            StockDA stockDA = new StockDA();
            stockE.Quantity = int.Parse("5");
            stockE.MoneyID = int.Parse("6");
            bool exp = stockDA.UpdateQuantityATM(stockE);
            Assert.IsTrue(exp);
        }

        [TestMethod]
        public void CheckWithdraw1()
        {
            AccountEntites accountE = new AccountEntites();
            AccountDA accountDA = new AccountDA();
            CardEntites cardE = new CardEntites();
            accountE.Balance = 50000;
            cardE.CardNo = "1234567891234568";
            bool exp = accountDA.CheckWithdraw(accountE, cardE);
            Assert.IsTrue(exp);
        }
        [TestMethod]
        public void getBalance()
        {
            AccountEntites account_E = new AccountEntites();
            AccountDA account_DA = new AccountDA();
            CustomerEntites cus_E = new CustomerEntites();
            CardEntites card_E = new CardEntites();
            card_E.CardNo = "1234567891234567";
            decimal exp = 180000;
            decimal act = account_DA.getBalance(card_E);
            Assert.AreEqual(exp, act);
        }
    }
}
